Jim's
Tutorials

Spring 2018
course
site

This was really interesting. I had trouble getting the right "side" to take a user input (also had trouble telling who should be doing what)... sort of like getting your left and right hands confused. I kept making the server do things I'd meant for the client end to do. Eventually got it straightened out. It helped to read Socket Programming HowTo :https://docs.python.org/2/howto/sockets.html and Socket Programming in Python: https://www.geeksforgeeks.org/socket-programming-python/.

So I made a conversation between client and server, where client asks if one likes blue or green to deliver a fortune. I did this to prep for making the tic-tac-toe game.

python server.py
Socket successfully created
socket binded to 12345
socket is listening
Got connection from ('127.0.0.1', 58543)
python client.py
Do you like blue or green? Ill tell you your fortune (b/g)

..and you select b or g (for blue or green) and it spits out the fortune that is sent to the server, except I made it be REVERSED on the server side and be sent back (usually it says "you will marry a rich daughter"):

python client.py
Do you like blue or green? Ill tell you your fortune (b/g)g
rethguad hcir a yrram lliw uoy

attachments [paper clip]

  last modified size
TXT client.py Mon Apr 29 2024 07:30 am 657B
TXT function.py Mon Apr 29 2024 07:30 am 801B
TXT server.py Mon Apr 29 2024 07:30 am 1.2K